package com.xtweb.controller;


import java.util.HashMap;
import java.util.Map;

import com.jfinal.core.Controller;
import com.xtweb.model.ArticleDemoList;
import com.xtweb.model.Menu;
import com.xtweb.utils.JsonUtil;

public final class Health extends Controller {
	public void index() {
		setAttr("title", "健康");
		setAttr("res", "/res/Health");
		render("/Health/index.html");
	}
	public void action() {
		String title="";//网页标题
		String name=getPara(0);
		switch (name) {
		case "xywy":
			title="寻医问药";
			break;
		case "xsyx":
			title="修身养性";
			break;
		case "qwjg":
			title="权威机构";
			break;
		case "myjt":
			title="名医讲堂";
			break;
		default:
			setAttr("title", "页面未找到~");
			render("/404.html");
			return;
		}
		
		Map<String,Object> map=new HashMap<String, Object>();
		map.put("res","/res/Health");
		map.put("name",name);
		map.put("title", title);
		map.put("list", new ArticleDemoList().article());
		setAttr("map",map);
		
		render("/Health/list.html");
	}
	
	/*
	 * 子菜单列表
	 * */
	public void subMenu() {
		String str="var menu="+JsonUtil.listToJson(new Menu().menulist())+";";
		renderText(str);
	}
	/*
	 * 文章列表
	 * */
	public void articleList() {
		String str="var article="+JsonUtil.listToJson(new ArticleDemoList().article())+";";
		renderText(str);
	}
}
